﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mani.Common
{
    public static class DateTimeHelpers
    {

        public static string ToJalali(this DateTime input)
        {
            return MyPersianDate.DateTimeToPersian(input);
        }

        public static string ToJalali(this DateTime? input)
        {
            if (!input.HasValue)
                return String.Empty;

            return MyPersianDate.DateTimeToPersian(input);
        }

        public static string ToJalaliWithTime(this DateTime input)
        {
            return MyPersianDate.DateTimeToPersianWithTime(input);
        }

        public static string ToJalaliWithTime(this DateTime? input)
        {
            if (!input.HasValue)
                return String.Empty;

            return MyPersianDate.DateTimeToPersianWithTime(input.Value);
        }

        public static DateTime ToDateTime(this String input)
        {
            return MyPersianDate.PersianToDateTime(input);
        }
    }
}
